const app = getApp()

Page({
  /**
   * 页面的初始数据
   */
  data: {
    UserImage: '',
    Username: '',
    imgUrl: "",
    countryIndex: 1,
    i:0,
    countryList: ['能拼出这张算你赢', '比一比手速', '你拼出来你牛逼']
  },
  /**
   * 生命周期函数--监听页面加载
   */

  onLoad: function (options) {
    console.log("path" + options.temp)
    // this.setData({
    //   imgUrl: options.temp
    // })
    var _this = this
    wx.uploadFile({
      url: 'https://www.lertui.com/pintu/action/t_pintu_do.jsp?action=FileUpload', //仅为示例，非真实的接口地址
      filePath: options.temp,
      name: 'file',
      success: function (res) {
        var data = JSON.parse(res.data)
        var url = "https://www.lertui.com/pintu/images/" + data.fileName
        console.log(url)
        _this.setData({
          imgUrl: url
        })
      }
    })
  },
  changeCountry(e) {
    this.setData({
      countryIndex: e.detail.value
    });
  },
  clickItemBtn(e){
    let index = e.currentTarget.dataset.index;
    this.i = index;
    this.setData({
      i: index
    });
  },
  shareImg(){
    wx.navigateTo({
      url: '../share/share',
    })
  },
  onReady: function () {
    // 页面渲染完成
  },
  onShow: function () {
    // 页面显示
  },
  onHide: function () {
    // 页面隐藏
  },
  onUnload: function () {
    // 页面关闭
  }

})